#ifndef LIVESLAVEWIDGET_H
#define LIVESLAVEWIDGET_H

#include <QWidget>
#include <QDebug>
#include <QBuffer>
#include <QImageReader>
#include <QLabel>
#include "../MyTcp2/tcpsession.h"

class MainWidget;
class TcpSession;

namespace Ui {
class LiveSlaveWidget;
}

class LiveSlaveWidget : public QWidget
{
    Q_OBJECT

public:
    explicit LiveSlaveWidget(TcpSession* session,MainWidget* mainWidget, QWidget *parent = nullptr);

    void show(QString & username, QString & nickname, QString& housename, int & houseID);

private slots:
    void on_pushButton_exit_clicked();
    void on_pushButton_bullet_clicked();
    void on_pushButton_gift_clicked();
    void on_pushButton_opt_clicked();

    void resizeEvent(QResizeEvent *event) override;

    void on_houseMems_signal(const QStringList& fields);
    void on_houseMsg_signal(const QString & msg="");
    void on_video_signal(QImage image);
    void on_camera_signal(QImage image);
    void on_gift_signal(const QString & nickname, const QString & houseid,const QString & gift);
    void on_bullet_signal(const QString & nickname,const QString & houseid, const QString & msg);
    void on_logout_call_signal(const QString& msg);

    void timeArrived();
private:
    Ui::LiveSlaveWidget *ui;
    MainWidget* mainWidget;
    QLabel* subLabel;

    QString username;
    QString nickname;
    QString housename;
    int houseID;

    TcpSession* session=nullptr;

    QTimer *timer=nullptr;
    QVector<QLabel*> bullLabels;//弹幕s
    QVector<QLabel*> rockets;//火箭
};

#endif // LIVESLAVEWIDGET_H
